-
Notifications
You must be signed in to change notification settings - Fork 7
Add vertical mixing coefficients module #310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Add vertical mixing coefficients module #310
Conversation
philipwjones
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails on Frontier GPU with a memory access error, so some array/variable may be missing or not scoped? I have some other comments spread below.
| bool Enabled = true; ///< Enable convective mixing flag | ||
|
|
||
| // Convective mixing parameters | ||
| Real ConvDiff = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize that these (and similar parameters for other options) will be overwritten by config values, but might want to initialize to zero or some unphysical value to cause it to fail or produce bad results if not initialized later.
| // and outputs the Brunt-Vaisala frequency. | ||
| KOKKOS_FUNCTION void operator()(Array2DReal BruntVaisalaFreq, I4 ICell, | ||
| const Array2DReal &SpecVol) const { | ||
| Real Gravity = 9.80616; // gravitational acceleration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should use shared constant here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vanroekel I agree, but that PR has not gone through yet
@philipwjones did the error provide any more information than that? At the moment my Frontier build is stopping at the cmake step (it keeps hanging at the |
|
@katsmith133 No additional info and I didn't have a chance to narrow it further, but I forgot to mention that it failed both EOS and VertMix unit tests, so it could point to something in the EOS additions. And I think this was with the AMD compiler - I can look into it further next week if no one gets to it first. |
Thanks @philipwjones! I am in a Deep Learning course this week, and probably will not get to it. So if you have time, that would be appreciated! If not, I can pick it back up next week. |
mwarusz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a chance to look into the test failures of this PR on Frontier. There are issues with accessing host pointers on the device in EosTest.cpp and VertMixTest.cpp. My suggestion shows how to fix one loop, but similar changes need to be applied for all accesses to VCoord->ZMid and various Mesh->X arrays in these two tests.
| parallelFor( | ||
| "populateArrays", {Mesh->NCellsAll, VCoord->NVertLayers}, | ||
| KOKKOS_LAMBDA(I4 ICell, I4 K) { | ||
| VCoord->ZMid(ICell, K) = -K; | ||
| Mesh->NEdgesOnCell(ICell) = 5; | ||
| Mesh->AreaCell(ICell) = 3.6e10_Real; | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| parallelFor( | |
| "populateArrays", {Mesh->NCellsAll, VCoord->NVertLayers}, | |
| KOKKOS_LAMBDA(I4 ICell, I4 K) { | |
| VCoord->ZMid(ICell, K) = -K; | |
| Mesh->NEdgesOnCell(ICell) = 5; | |
| Mesh->AreaCell(ICell) = 3.6e10_Real; | |
| }); | |
| const auto &ZMid = VCoord->ZMid; | |
| const auto &NEdgesOnCell = Mesh->NEdgesOnCell; | |
| const auto &AreaCell = Mesh->AreaCell; | |
| parallelFor( | |
| "populateArrays", {Mesh->NCellsAll, VCoord->NVertLayers}, | |
| KOKKOS_LAMBDA(I4 ICell, I4 K) { | |
| ZMid(ICell, K) = -K; | |
| NEdgesOnCell(ICell) = 5; | |
| AreaCell(ICell) = 3.6e10_Real; | |
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mwarusz I can make those changes.
| "Vertical viscosity at center and" | ||
| " top of cell", // Long Name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "Vertical viscosity at center and" | |
| " top of cell", // Long Name | |
| "Vertical viscosity at center of cell and" | |
| " top of layer", // Long Name |
Add the
VertMixclass to Omega, which consists of:Methods to calculate the vertical diffusivity and viscosity using (for now just) the
PPoption, which can linearly add contributions from background, convective, and shear mixing based upon user choices in the config file. TheVertMixoptions and parameter values are set in the yaml config file. There is a dummyKPPoption in there now to set up the structure for adding it in the near future (I can remove if we think this is messy). This PR includes tests for each individual mixing process (background, convective, and shear), as well as one that linearly adds all of them together. Because both the convective and shear mixing require the Brunt Vaiasla frequency, this PR also adds the calculation ofBruntVaisalaFreqto the EOS class and adds corresponding tests. TheBruntVaisalaFreqis calculated in the way that was in MPAS-O if the Linear EOS is used (i.e. with linear coefficients and the derivative based upon changes inz) and is calculated in the same way the TEOS-10 package calculates it if the TEOS-10 EOS is used (i.e. with non-linear coefficients and the derivative based upon changes inp).Ran ctests successfully on pm-cpu, pm-gpu, and chrysalis.
Checklist